{% extends "base.html" %}
{% block title %}{{ lang.menu_links.monitoring.net_tools }}{% endblock %}
{% block h2 %}{{ lang.menu_links.monitoring.net_tools }}{% endblock %}
{% block content %}
{% from 'include/input_macros.html' import input, checkbox, select %}
<script src="/app/static/js/nettools.js"></script>
<form name="nettools_icmp_form" id="nettools_icmp_form" method="post" action="/app/nettools/icmp">
    <table class="overview">
        <caption><h3>ICMP</h3></caption>
        <tr class="overviewHead">
            <th class="padding10 first-collumn">{{lang.words.from|title()}}</th>
            <th class="padding10 first-collumn">{{lang.words.to|title()}}</th>
            <th class="padding10 first-collumn"></th>
            <th></th>
        </tr>
        <tr>
            <td class="padding10 first-collumn">
                <select autofocus required name="server_from" id="nettools_icmp_server_from">
                    <option disabled selected>------</option>
                    <option value="localhost">Roxy-WI</option>
                    {% for server in g.user_params['servers'] %}
                    <option value="{{ server.2 }}">{{ server.1 }}</option>
                        {% endfor %}
                    </select>
            </td>
            <td class="padding10 first-collumn">
                {{ input('nettools_icmp_server_to', name='server_to', title=lang.nettools_page.ip_or_name) }}
                {{ input('token', value=token, type='hidden') }}
            </td>
            <td class="padding10 first-collumn">
                <button type="submit" title="{{lang.words.run|title()}} Ping" id="nettools_ping" name="nettools_ping" value="nettools_ping">Ping</button>
            </td>
            <td>
                <button type="submit" title="{{lang.words.run|title()}} Traceroute" id="nettools_trace" name="nettools_trace" value="nettools_trace">Traceroute</button>
            </td>
        </tr>
    </table>
</form>
<form name="nettools_telnet_form" id="nettools_telnet_form" method="post" action="/app/nettools/tcp">
    <table class="overview">
        <caption><h3>Check port</h3></caption>
        <tr class="overviewHead">
            <th class="padding10 first-collumn">{{lang.words.from|title()}}</th>
            <th class="padding10 first-collumn">{{lang.words.to|title()}}</th>
            <th class="padding10 first-collumn">{{lang.words.port|title()}}</th>
            <th></th>
        </tr>
        <tr>
            <td class="padding10 first-collumn">
                <select autofocus required name="server_from" id="nettools_telnet_server_from">
                    <option disabled selected>------</option>
                    <option value="localhost">Roxy-WI</option>
                    {% for server in g.user_params['servers'] %}
                    <option value="{{ server.2 }}">{{ server.1 }}</option>
                    {% endfor %}
                </select>
            </td>
            <td class="padding10 first-collumn">
                {{ input('nettools_telnet_server_to', name='server_to', title=lang.nettools_page.ip_or_name) }}
                {{ input('token', value=token, type='hidden') }}
            </td>
            <td class="padding10 first-collumn">
                {{ input('nettools_telnet_port_to', title=lang.words.port|title() + ' ' + lang.words.port, type='number', style='width: 60px;') }}
            </td>
            <td>
                <button type="submit" title="{{lang.words.run|title()}} Telnet" id="nettools_telnet" name="nettools_telnet" value="nettools_telnet">{{lang.words.connect|title()}}</button>
            </td>
        </tr>
    </table>
</form>
<form name="nettools_nslookup_form" id="nettools_nslookup_form" method="post" action="/app/nettools/dns">
    <table class="overview">
        <caption><h3>NSLookup</h3></caption>
        <tr class="overviewHead">
            <th class="padding10 first-collumn">{{lang.words.from|title()}}</th>
            <th class="padding10 first-collumn">{{lang.words.record_type}} </th>
            <th class="padding10 first-collumn">DNS {{lang.words.name}}</th>
            <th></th>
        </tr>
        <tr>
            <td class="padding10 first-collumn">
                <select autofocus required name="server_from" id="nettools_nslookup_server_from">
                    <option disabled selected>------</option>
                    <option value="localhost">Roxy-WI</option>
                    {% for server in g.user_params['servers'] %}
                    <option value="{{ server.2 }}">{{ server.1 }}</option>
                    {% endfor %}
                </select>
            </td>
            <td class="padding10 first-collumn">
                {% set values = dict() %}
                {% set values = {'A':'A','AAA':'AAA', 'CNAME':'CNAME', 'MX':'MX', 'TXT':'TXT', 'PTR':'PTR', 'SRV':'SRV',
                'SOA':'SOA', 'CAA':'CAA'} %}
                {{ select('nettools_nslookup_record_type', values=values, selected='A', required='required') }}
            </td>
            <td class="padding10 first-collumn">
                {{ input('nettools_nslookup_name', title=lang.nettools_page.dns_name) }}
                {{ input('token', value=token, type='hidden') }}
            </td>
            <td>
                <button type="submit" title="{{lang.words.run|title()}} Telnet" id="nettools_nslookup" name="nettools_nslookup" value="nettools_nslookup">{{lang.words.check|title()}}</button>
            </td>
        </tr>
    </table>
</form>
<form name="nettools_portscanner_form" id="nettools_portscanner_form" method="post" action="/app/nettools/portscan">
    <table class="overview" style="width: 40%;float: left;">
        <caption><h3>Port scanner</h3></caption>
        <tr class="overviewHead">
            <th class="padding10 first-collumn">{{lang.words.server|title()}}</th>
            <th></th>
        </tr>
        <tr>
            <td class="padding10 first-collumn">
                {{ input('nettools_portscanner_server', title=lang.nettools_page.server_portscann) }}
            </td>
            <td class="padding10" style="width: 0">
                <button type="submit" title="{{lang.words.run|title()}} port scanning" id="nettools_portscan" name="nettools_portscan" value="nettools_portscan">{{lang.words.run|title()}}</button>
            </td>
        </tr>
    </table>
</form>
<form name="nettools_whois_form" id="nettools_whois_form" method="post" action="/app/nettools/whois">
    <table class="overview" style="width: 60%;">
        <caption><h3>Whois</h3></caption>
        <tr class="overviewHead">
            <th class="padding10 first-collumn">{{lang.words.name|title()}}</th>
            <th></th>
        </tr>
        <tr>
            <td class="padding10 first-collumn">
                {{ input('nettools_whois_name', title=lang.nettools_page.dns_name) }}
            </td>
            <td class="padding10" style="width: 0">
                <button type="submit" title="{{lang.words.check|title()}}" id="nettools_whois" name="nettools_whois" value="nettools_whois">{{lang.words.check|title()}}</button>
            </td>
        </tr>
    </table>
</form>
<div id="ajax-nettools" style="padding: 20px;"></div>
<div id="show_scans_ports" style="display: none; padding: 0;">
    <div id="show_scans_ports_body"></div>
</div>
{% endblock %}
